{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <title>Store - Авторизация</title>
    <link href="{% static 'css/auth.css' %}" rel="stylesheet"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/js/all.min.js"
            crossorigin="anonymous"></script>
</head>
<body class="bg-primary">
<div id="layoutAuthentication">
    <div id="layoutAuthentication_content">
        <main>
            <div class="container">
                <div class="row justify-content-center">
                    <div class="col-lg-5">
                      {% if messages or form.errors %}
                        <div class="alert
                        {% if messages %} alert-success {% else %} alert-warning {% endif %}
                        alert-dismissible fade show" role="alert"
                             style="margin-top: 50px;">
                          {% if messages %}
                            {% for message in messages %}
                              {{ message }}
                            {% endfor %}
                          {% else %}
                            {{ form.non_field_errors }}
                          {% endif %}
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                      {% endif %}
                        <div class="card shadow-lg border-0 rounded-lg mt-5">
                            <div class="card-header"><h3 class="text-center font-weight-light my-4">Авторизация</h3>
                            </div>
                            <div class="card-body">
                                <form action="{% url 'users:login' %}" method="post">
                                  {% csrf_token %}
{#                                  {{ form.as_p }}#}
                                    <div class="form-group">
                                        <label class="small mb-1" for="{{ form.username.id_for_label }}">Имя пользователя</label>
                                        {{ form.username }}
                                    </div>
                                    <div class="form-group">
                                        <label class="small mb-1" for="{{ form.password.id_for_label }}">Пароль</label>
                                        {{ form.password }}
                                    </div>
                                    <div class="form-group d-flex align-items-center justify-content-between mt-4 mb-0">
                                        <a class="small" href="#">Забыли пароль?</a>
                                        <input class="btn btn-primary" type="submit" value="Авторизоваться">
                                    </div>
                                </form>
                            </div>
                            <div class="card-footer text-center">
                                <div class="small"><a href="{% url 'users:register' %}">Нужен аккаунт? Зарегистрируйся!</a></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
    </div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"
        crossorigin="anonymous"></script>
<script src="{% static 'js/auth.js' %}"></script>
</body>
</html>
